/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cs575.wido.action;

import cs575.client.Session;
import cs575.client.WiDo;
import cs575.wido.UserSession;
import cs575.wido.WebServiceFactory;
import cs575.wido.ui.GroupDetailsWindow;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;

/**
 *
 * @author kevincheung
 */
public class AddGroupAction extends AbstractAction {
	private GroupDetailsWindow parent;
	
	public AddGroupAction(GroupDetailsWindow parent) {
		putValue(NAME, "OK");
		this.parent = parent;
	}
	
	@Override
	public void actionPerformed(ActionEvent ae) {
		WiDo wido = WebServiceFactory.getPort();
		UserSession userSession = UserSession.getInstance();
		Session session = userSession.getSession();
		
		String name = parent.getName();
		//String description = parent.getDescription();
		
		//cs575.client.GroupEx = wido.createGroup(session, name, description);
		
		/* TODO
		cs575.client.Task t = wido.createTask(session, name, description, due_date, 2);
		if(t != null) {
			JOptionPane.showMessageDialog(null, "Taskname"+t.getTaskName());
			parent.dispose();
		}
		else {
			JOptionPane.showMessageDialog(null, "no task");
		}
		 *
		 */
	}
	
}
